<template>
  <div>
    <div class="card">
      <div class="title1">公告列表</div>

      <el-timeline :reverse="reverse">
        <el-timeline-item
          v-for="(activity, index) in activities"
          :key="index"
          :timestamp="activity.cjsj"
        >
          {{ activity.title }}
        </el-timeline-item>
      </el-timeline>
    </div>
  </div>
</template>
<style scoped>
.title1 {
  margin-bottom: 30px;
  font-size: 20px;
  font-weight: bold;
}
.card {
  padding: 20px;
  background-color: #fff;
  border-radius: 5px;
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);
}
</style>
<script>
import service from '../request';
export default {
  data() {
    return {
      reverse: true,
      activities:[],
    };
  },
  mounted() {
    if (!window.localStorage.getItem("token")) {
      this.$router.push("/");
      this.$message.warning("当前用户未登录");
    }
    this.getdata()
  },
  methods:{
    async  getdata(){
const res=await service.get("index/gonggaoall");
     console.log(res)
     this.activities=res.data
     }
  }
};
</script>